#ifndef _Tags_h_
#define _Tags_h_
namespace Elements
{
	using namespace Upp;
    const uint32 AENC=0x41454E47;
    const uint32 APIC=0x41504943;
    const uint32 ASPI=0x41535049;
    const uint32 COMM=0x434F4D4D;
    const uint32 COMR=0x434F4D52;
    const uint32 ENCR=0x454E4352;
    const uint32 EQU2=0x45515532;
    const uint32 EQUA=0x45515541;
    const uint32 ETCO=0x4554434F;
    const uint32 GEOB=0x47454F42;
    const uint32 GRID=0x47524944;
    const uint32 IPLS=0x49504C53;
    const uint32 LINK=0x4C494E4B;
    const uint32 MCDI=0x4D434449;
    const uint32 MLLT=0x4D4C4C54;
    const uint32 OWNE=0x4F574E45;
    const uint32 PCNT=0x50434E58;
    const uint32 POPM=0x504F504D;
    const uint32 POSS=0x504F5353;
    const uint32 PRIV=0x50524956;
    const uint32 RBUF=0x52425546;
    const uint32 RGAD=0x52474144;
    const uint32 RVA2=0x52564132;
    const uint32 RVRB=0x52565242;
    const uint32 SEEK=0x5345454B;
    const uint32 SIGN=0x5349474E;
    const uint32 SYLT=0x53594C54;
    const uint32 SYTC=0x53595443;
    const uint32 TALB=0x54414C42;
    const uint32 TBPM=0x5442504D;
    const uint32 TCMP=0x54434D50;
    const uint32 TCOM=0x54434F4D;
    const uint32 TCON=0x54434F4E;
    const uint32 TCOP=0x54434F50;
    const uint32 TDAT=0x54444154;
    const uint32 TDEN=0x5444454E;
    const uint32 TDLY=0x54444C59;
    const uint32 TDOR=0x54444F52;
    const uint32 TDRC=0x54445243;
    const uint32 TDRL=0x5444524C;
    const uint32 TDTG=0x54445447;
    const uint32 TENC=0x54454E43;
    const uint32 TEXT=0x54455854;
    const uint32 TFLT=0x54464C54;
    const uint32 TIME=0x54494D45;
    const uint32 TIPL=0x5449504C;
    const uint32 TIT1=0x54495431;
    const uint32 TIT2=0x54495432;
    const uint32 TIT3=0x54495433;
    const uint32 TKEY=0x544B4559;
    const uint32 TLAN=0x544C414E;
    const uint32 TLEN=0x544C454E;
    const uint32 TMCL=0x544D434C;
    const uint32 TMED=0x544D4544;
    const uint32 TMOO=0x544D4F4F;
    const uint32 TOAL=0x544F414C;
    const uint32 TOFN=0x544F464E;
    const uint32 TOLY=0x544F4C59;
    const uint32 TOPE=0x544F5045;
    const uint32 TORY=0x544F5259;
    const uint32 TOWN=0x544F574E;
    const uint32 TPE1=0x54504531;
    const uint32 TPE2=0x54504532;
    const uint32 TPE3=0x54504533;
    const uint32 TPE4=0x54504534;
    const uint32 TPOS=0x54504F53;
    const uint32 TPRO=0x5450524F;
    const uint32 TPUB=0x54505542;
    const uint32 TRCK=0x5452434B;
    const uint32 TRDA=0x54524441;
    const uint32 TRSN=0x5452534E;
    const uint32 TRSO=0x5452534F;
    const uint32 TSIZ=0x5453495A;
    const uint32 TSO2=0x54534F32;
    const uint32 TSOA=0x54534F41;
    const uint32 TSOC=0x54534F43;
    const uint32 TSOP=0x54534F50;
    const uint32 TSOT=0x54534F54;
    const uint32 TSRC=0x54535243;
    const uint32 TSSE=0x54535345;
    const uint32 TSST=0x54535354;
    const uint32 TXXX=0x54585858;
    const uint32 TYER=0x54594552;
    const uint32 UFID=0x55464944;
    const uint32 USER=0x55534552;
    const uint32 USLT=0x55534C54;
    const uint32 WCOM=0x57434F4D;
    const uint32 WCOP=0x57434F50;
    const uint32 WOAF=0x574F4146;
    const uint32 WOAR=0x574F4152;
    const uint32 WOAS=0x574F4153;
    const uint32 WORS=0x574F5253;
    const uint32 WPAY=0x57504159;
    const uint32 WPUB=0x57505542;
    const uint32 WXXX=0x57585858;
    const uint32 XRVA=0x58525641;
    const uint32 BUF=0x425546;
    const uint32 CNT=0x434E56;
    const uint32 COM=0x434F4D;
    const uint32 CRA=0x435241;
    const uint32 CRM=0x43524D;
    const uint32 EQU=0x455155;
    const uint32 ETC=0x455443;
    const uint32 GEO=0x47454F;
    const uint32 IPL=0x49504C;
    const uint32 LNK=0x4C4E4B;
    const uint32 MCI=0x4D4349;
    const uint32 MLL=0x4D4C4C;
    const uint32 PIC_=0x504943; //PIC is used by shared libs in GCC
    const uint32 POP=0x504F50;
    const uint32 REV=0x524556;
    const uint32 RVA=0x525641;
    const uint32 SLT=0x534C54;
    const uint32 STC=0x535443;
    const uint32 TAL=0x54414C;
    const uint32 TBP=0x544250;
    const uint32 TCM=0x54434D;
    const uint32 TCO=0x54434F;
    const uint32 TCP=0x544350;
    const uint32 TCR=0x544352;
    const uint32 TDA=0x544441;
    const uint32 TDY=0x544459;
    const uint32 TEN=0x54454E;
    const uint32 TFT=0x544654;
    const uint32 TIM=0x54494D;
    const uint32 TKE=0x544B45;
    const uint32 TLA=0x544C41;
    const uint32 TLE=0x544C45;
    const uint32 TMT=0x544D54;
    const uint32 TOA=0x544F41;
    const uint32 TOF=0x544F46;
    const uint32 TOL=0x544F4C;
    const uint32 TOR=0x544F52;
    const uint32 TOT=0x544F54;
    const uint32 TP1=0x545031;
    const uint32 TP2=0x545032;
    const uint32 TP3=0x545033;
    const uint32 TP4=0x545034;
    const uint32 TPA=0x545041;
    const uint32 TPB=0x545042;
    const uint32 TRC=0x545243;
    const uint32 TRD=0x545244;
    const uint32 TRK=0x54524B;
    const uint32 TSI=0x545349;
    const uint32 TSS=0x545353;
    const uint32 TT1=0x545431;
    const uint32 TT2=0x545432;
    const uint32 TT3=0x545433;
    const uint32 TXT=0x545854;
    const uint32 TXX=0x545858;
    const uint32 TYE=0x545945;
    const uint32 UFI=0x554649;
    const uint32 ULT=0x554C54;
    const uint32 WAF=0x574146;
    const uint32 WAR=0x574152;
    const uint32 WAS=0x574153;
    const uint32 WCM=0x57434D;
    const uint32 WCP=0x574350;
    const uint32 WPB=0x575042;
    const uint32 WXX=0x575858;
}

struct structContentList {
	int id;
	const char *name;
};

const structContentList contentTypeCodeList[]  = {
{0, "Blues"}, 
{1, "Classic Rock"}, 
{2, "Country"}, 
{3, "Dance"}, 
{4, "Disco"}, 
{5, "Funk"}, 
{6, "Grunge"}, 
{7, "Hip-Hop"}, 
{8, "Jazz"}, 
{9, "Metal"}, 
{10, "New Age"}, 
{11, "Oldies"}, 
{12, "Other"}, 
{13, "Pop"}, 
{14, "R&B"}, 
{15, "Rap"}, 
{16, "Reggae"}, 
{17, "Rock"}, 
{18, "Techno"}, 
{19, "Industrial"}, 
{20, "Alternative"}, 
{21, "Ska"}, 
{22, "Death Metal"}, 
{23, "Pranks"}, 
{24, "Soundtrack"}, 
{25, "Euro-Techno"}, 
{26, "Ambient"}, 
{27, "Trip-Hop"}, 
{28, "Vocal"}, 
{29, "Jazz+Funk"}, 
{30, "Fusion"}, 
{31, "Trance"}, 
{32, "Classical"}, 
{33, "Instrumental"}, 
{34, "Acid"}, 
{35, "House"}, 
{36, "Game"}, 
{37, "Sound Clip"}, 
{38, "Gospel"}, 
{39, "Noise"}, 
{40, "AlternRock"}, 
{41, "Bass"}, 
{42, "Soul"}, 
{43, "Punk"}, 
{44, "Space"}, 
{45, "Meditative"}, 
{46, "Instrumental Pop"}, 
{47, "Instrumental Rock"}, 
{48, "Ethnic"}, 
{49, "Gothic"}, 
{50, "Darkwave"}, 
{51, "Techno-Industrial"}, 
{52, "Electronic"}, 
{53, "Pop-Folk"}, 
{54, "Eurodance"}, 
{55, "Dream"}, 
{56, "Southern Rock"}, 
{57, "Comedy"}, 
{58, "Cult"}, 
{59, "Gangsta"}, 
{60, "Top 40"}, 
{61, "Christian Rap"}, 
{62, "Pop/Funk"}, 
{63, "Jungle"}, 
{64, "Native American"}, 
{65, "Cabaret"}, 
{66, "New Wave"}, 
{67, "Psychadelic"}, 
{68, "Rave"}, 
{69, "Showtunes"}, 
{70, "Trailer"}, 
{71, "Lo-Fi"}, 
{72, "Tribal"}, 
{73, "Acid Punk"}, 
{74, "Acid Jazz"}, 
{75, "Polka"}, 
{76, "Retro"}, 
{77, "Musical"}, 
{78, "Rock & Roll"}, 
{79, "Hard Rock"}, 
{80, "Folk"}, 
{81, "Folk-Rock"}, 
{82, "National Folk"}, 
{83, "Swing"}, 
{84, "Fast Fusion"}, 
{85, "Bebob"}, 
{86, "Latin"}, 
{87, "Revival"}, 
{88, "Celtic"}, 
{89, "Bluegrass"}, 
{90, "Avantgarde"}, 
{91, "Gothic Rock"}, 
{92, "Progressive Rock"}, 
{93, "Psychedelic Rock"}, 
{94, "Symphonic Rock"}, 
{95, "Slow Rock"}, 
{96, "Big Band"}, 
{97, "Chorus"}, 
{98, "Easy Listening"}, 
{99, "Acoustic"}, 
{100, "Humour"}, 
{101, "Speech"}, 
{102, "Chanson"}, 
{103, "Opera"}, 
{104, "Chamber Music"}, 
{105, "Sonata"}, 
{106, "Symphony"}, 
{107, "Booty Bass"}, 
{108, "Primus"}, 
{109, "Porn Groove"}, 
{110, "Satire"}, 
{111, "Slow Jam"}, 
{112, "Club"}, 
{113, "Tango"}, 
{114, "Samba"}, 
{115, "Folklore"}, 
{116, "Ballad"}, 
{117, "Power Ballad"}, 
{118, "Rhythmic Soul"}, 
{119, "Freestyle"}, 
{120, "Duet"}, 
{121, "Punk Rock"}, 
{122, "Drum Solo"}, 
{123, "A capella"}, 
{124, "Euro-House"}, 
{125, "Dance Hall"}};

#endif


/*
             if (Key==_T("ADDED_TIMESTAMP"))        Fill(StreamKind_Common,   0, "Added_Date", Ztring().Date_From_Milliseconds_1601(Value.To_int64u()/1000));
        else if (Key==_T("ALBUM ARTIST"))           {if (Value!=Retrieve(StreamKind_Common,   0, "Performer")) Fill(StreamKind_Common,   0, "Performer", Value);}
        else if (Key==_T("ALBUM"))                  Fill(StreamKind_Common,   0, "Album", Value);
        else if (Key==_T("ALBUM_COMMENT"))          Fill(StreamKind_Common,   0, "Comment", Value);
        else if (Key==_T("ALBUMARTIST"))            {if (Value!=Retrieve(StreamKind_Common,   0, "Performer")) Fill(StreamKind_Common,   0, "Performer", Value);}
        else if (Key==_T("ARTIST"))                 {if (Value!=Retrieve(StreamKind_Common,   0, "Performer")) Fill(StreamKind_Common,   0, "Performer", Value);}
        else if (Key==_T("AUTHOR"))                 Fill(StreamKind_Common,   0, "WrittenBy", Value);
        else if (Key==_T("BUYCDURL"))               {}
        else if (Key==_T("CLASS"))                  Fill(StreamKind_Common,   0, "ContentType", Value);
        else if (Key==_T("COMPOSER"))               Fill(StreamKind_Common,   0, "Composer", Value);
        else if (Key==_T("COMMENT"))                Fill(StreamKind_Common,   0, "Comment", Value);
        else if (Key==_T("COMMENTS"))               Fill(StreamKind_Common,   0, "Comment", Value);
        else if (Key==_T("CONDUCTOR"))              Fill(StreamKind_Common,   0, "Conductor", Value);
        else if (Key==_T("CONTACT"))                Fill(StreamKind_Common,   0, "Publisher", Value);
        else if (Key==_T("COPYRIGHT"))              Fill(StreamKind_Common,   0, "Copyright", Value);
        else if (Key==_T("DATE"))                   Fill(StreamKind_Common,   0, "Recorded_Date", Value, true);
        else if (Key==_T("DESCRIPTION"))            Fill(StreamKind_Common,   0, "Description", Value);
        else if (Key==_T("DISC"))                   Fill(StreamKind_Common,   0, "Part", Value, true);
        else if (Key==_T("DISCNUMBER"))             Fill(StreamKind_Common,   0, "Part", Value, true);
        else if (Key==_T("ENCODEDBY"))              Fill(StreamKind_Common,   0, "EncodedBy", Value);
        else if (Key==_T("ENCODER"))                Fill(StreamKind_Common,   0, "Encoded_Application", Value);
        else if (Key==_T("ENCODED_USING"))          Fill(StreamKind_Common,   0, "Encoded_Application", Value);
        else if (Key==_T("ENCODER_URL"))            Fill(StreamKind_Common,   0, "Encoded_Application/Url", Value);
        else if (Key==_T("ENSEMBLE"))               {if (Value!=Retrieve(StreamKind_Common,   0, "Performer")) Fill(StreamKind_Common,   0, "Accompaniment", Value);}
        else if (Key==_T("GENRE"))                  Fill(StreamKind_Common,   0, "Genre", Value);
        else if (Key==_T("FIRST_PLAYED_TIMESTAMP")) Fill(StreamKind_Common,   0, "Played_First_Date", Ztring().Date_From_Milliseconds_1601(Value.To_int64u()/10000));
        else if (Key==_T("ISRC"))                   Fill(StreamKind_Multiple, 0, "ISRC", Value);
        else if (Key==_T("LABEL"))                  Fill(StreamKind_Common,   0, "Label", Value);
        else if (Key==_T("LANGUAGE"))               {if (Value.find(_T("Director"))==0) Fill(StreamKind_Specific, 0, "Language_More", Value); else if (!Value.SubString(_T("["), _T("]")).empty()) Fill(StreamKind_Specific, 0, "Language", Value.SubString(_T("["), _T("]"))); else Fill(StreamKind_Specific, 0, "Language", Value);}
        else if (Key==_T("LAST_PLAYED_TIMESTAMP"))  Fill(StreamKind_Multiple, 0, "Played_Last_Date", Ztring().Date_From_Milliseconds_1601(Value.To_int64u()/10000));
        else if (Key==_T("LICENCE"))                Fill(StreamKind_Common,   0, "TermsOfUse", Value);
        else if (Key==_T("LYRICS"))                 Fill(StreamKind_Common,   0, "Lyrics", Value);
        else if (Key==_T("LWING_GAIN"))             Fill(StreamKind_Multiple, 0, "ReplayGain_Gain", Value.To_float64(), 2);
        else if (Key==_T("LOCATION"))               Fill(StreamKind_Common,   0, "Recorded/Location", Value);
        else if (Key==_T("ORGANIZATION"))           Fill(StreamKind_Common,   0, "Producer", Value);
        else if (Key==_T("PERFORMER"))              Fill(StreamKind_Common,   0, "Performer", Value);
        else if (Key==_T("PLAY_COUNT"))             Fill(StreamKind_Multiple, 0, "Played_Count", Value.To_int64u());
        else if (Key==_T("RATING"))                 Fill(StreamKind_Multiple, 0, "Rating", Value);
        else if (Key==_T("REPLAYGAIN_ALBUM_GAIN"))  Fill(StreamKind_Common,   0, "Album_ReplayGain_Gain", Value.To_float64(), 2);
        else if (Key==_T("REPLAYGAIN_ALBUM_PEAK"))  Fill(StreamKind_Common,   0, "Album_ReplayGain_Peak", Value.To_float64(), 6);
        else if (Key==_T("REPLAYGAIN_TRACK_GAIN"))  Fill(StreamKind_Specific, 0, "ReplayGain_Gain",       Value.To_float64(), 2);
        else if (Key==_T("REPLAYGAIN_TRACK_PEAK"))  Fill(StreamKind_Specific, 0, "ReplayGain_Peak",       Value.To_float64(), 6);
        else if (Key==_T("TITLE"))                  Fill(StreamKind_Common,   0, "Title", Value);
        else if (Key==_T("TOTALTRACKS"))            Fill(StreamKind_Common,   0, "Track/Position_Total", Value);
        else if (Key==_T("TRACK_COMMENT"))          Fill(StreamKind_Multiple, 0, "Comment", Value);
        else if (Key==_T("TRACKNUMBER"))            Fill(StreamKind_Multiple, 0, "Track/Position", Value);
        else if (Key==_T("VERSION"))                Fill(StreamKind_Common,   0, "Track/More", Value);
        else if (Key==_T("BPM"))                    Fill(StreamKind_Common,   0, "BPM", Value);
        else if (Key==_T("WAVEFORMATEXTENSIBLE_CHANNEL_MASK"))
        {
            //This is an hexadecimal value
            if (Value.size()>2 && Value[0]==_T('0') && Value[1]==_T('x'))
            {
                int16u ValueI=0;
                for (size_t Pos=2; Pos<Value.size(); Pos++)
                {
                    ValueI*=16;
                    if (Value[Pos]>=_T('0') && Value[Pos]<=_T('9'))
                        ValueI+=Value[Pos]-_T('0');
                    else if (Value[Pos]>=_T('A') && Value[Pos]<=_T('F'))
                        ValueI+=10+Value[Pos]-_T('A');
                    else if (Value[Pos]>=_T('a') && Value[Pos]<=_T('f'))
                        ValueI+=10+Value[Pos]-_T('a');
                    else
                        break;
                }
                Fill(Stream_Audio, 0, Audio_ChannelPositions, ExtensibleWave_ChannelMask(ValueI));
                Fill(Stream_Audio, 0, Audio_ChannelPositions_String2, ExtensibleWave_ChannelMask2(ValueI));
            }
        }
        else if (Key==_T("YEAR"))                   {if (Value!=Retrieve(StreamKind_Common,   0, "Recorded_Date")) Fill(StreamKind_Common,   0, "Recorded_Date", Value);}
        else if (Key.find(_T("COVERART"))==0)
        {
                 if (Key==_T("COVERARTCOUNT"))
                ;
            else if (Key.find(_T("COVERARTMIME"))==0)
                Fill(Stream_General, 0, General_Cover_Mime, Value);
            else if (Key.find(_T("COVERARTFILELINK"))==0)
                Fill(Stream_General, 0, General_Cover_Data, _T("file://")+Value);
            else if (Key.find(_T("COVERARTTYPE"))==0)
                Fill(Stream_General, 0, General_Cover_Type, Id3v2_PictureType(Value.To_int8u()));
        }
        else if (Key.find(_T("CHAPTER"))==0)
        {
            if (Count_Get(Stream_Menu)==0)
            {
                Stream_Prepare(Stream_Menu);
                Fill(Stream_Menu, StreamPos_Last, Menu_Chapters_Pos_Begin, Count_Get(Stream_Menu, StreamPos_Last), 10, true);
            }
            if (Key.find(_T("NAME"))==Error)
            {
                Chapter_Pos=Key.SubString(_T("CHAPTER"), _T(""));
                Chapter_Time=Value;
            }
            else
            {
                Value.FindAndReplace(_T("\n"), _T(""), Count_Get(Stream_Text)-1); //Some chapters names have extra characters, not needed
                Value.FindAndReplace(_T("\r"), _T(""), Count_Get(Stream_Text)-1); //Some chapters names have extra characters, not needed
                Value.FindAndReplace(_T(" "),  _T(""), Count_Get(Stream_Text)-1); //Some chapters names have extra characters, not needed
                Fill(Stream_Menu, 0, Chapter_Time.To_UTF8().c_str(), Value);
            }
            Fill(Stream_Menu, StreamPos_Last, Menu_Chapters_Pos_End, Count_Get(Stream_Menu, StreamPos_Last), 10, true);
        }
        else                                Fill(Stream_General, 0, comment.SubString(_T(""), _T("=")).To_Local().c_str(), Value);
  */
  
  /*
     Skip_C3   (                                                 "ID");
    Get_Local (30, Title,                                       "Title");
    Get_Local (30, Artist,                                      "Artist");
    Get_Local (30, Album,                                       "Album");
    Get_Local ( 4, Year,                                        "Year");
    Get_Local (30, Comment,                                     "Comment");
    if (Comment.size()<29) //Id3v1.1 specifications : Track number addition
    {
        Element_Offset-=2;
        int8u Zero;
        Peek_B1(Zero);
        if (Zero==0)
        {
            Skip_B1(                                            "Zero");
            Get_B1 (Track,                                      "Track");
        }
        else
            Element_Offset+=2;
    }
    Get_B1 (Genre,                                              "Genre");
*/